### Common Setup Pattern Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/examples/overview.md Standard workflow for installing dependencies and running examples locally. ```bash # Install dependencies ./build.sh # For local development ./build.sh local # Run the example python demo.py # or server.py for API examples ``` -------------------------------- ### Install Dependencies and Run Example Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/examples/multi-agent.md Commands to install the required package, set the OpenAI API key, and execute the multi-agent script. ```bash pip install agentkernel[crewai] export OPENAI_API_KEY=sk-... python multi_agent.py ``` -------------------------------- ### Setup Development Environment Source: https://github.com/yaalalabs/agent-kernel/blob/develop/ak-py/README.md Clone the repository and install dependencies using uv or pip. ```bash git clone https://github.com/yaalalabs/agent-kernel.git cd agent-kernel/ak-py uv sync # or: pip install -e ".[dev]" ``` -------------------------------- ### Run development setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/DEVELOPER_GUIDE.md Install prerequisites and sync the virtual environment using the Makefile or script. ```bash make dev-setup ``` ```bash ./scripts/dev-setup.sh ``` -------------------------------- ### Run API Hooks Example Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/integrations/hooks.md Commands to build the environment, start the API server, run tests, or execute the direct usage example for the API hooks demonstration. ```bash cd examples/api/hooks # Build environment ./build.sh # Run the API server source .venv/bin/activate python app.py # Run tests (in another terminal) source .venv/bin/activate pytest app_test.py -v # Or run direct example python example_usage.py ``` -------------------------------- ### Build and Run Commands Source: https://github.com/yaalalabs/agent-kernel/blob/develop/examples/api/teams/README.md Commands to install dependencies and start the local server. ```bash ./build.sh ``` ```bash uv run server.py ``` -------------------------------- ### Prerequisites Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/ak-deployment/ak-gcp/common/run.md Install necessary tools, authenticate with Google Cloud, set the project ID, and enable required GCP APIs. ```bash # Install tools brew install terraform brew install google-cloud-sdk # Login gcloud auth login gcloud auth application-default login # Set project gcloud config set project YOUR_PROJECT_ID # Enable APIs gcloud services enable compute.googleapis.com gcloud services enable artifactregistry.googleapis.com gcloud services enable redis.googleapis.com gcloud services enable firestore.googleapis.com gcloud services enable vpcaccess.googleapis.com ``` -------------------------------- ### Install all features Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.2.0/installation.md Installs all available framework and utility extras. ```bash pip install agentkernel[openai,crewai,langgraph,adk,api,aws,cli] ``` -------------------------------- ### Development Installation Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/installation.md Clone the repository and install in development mode. ```bash # Clone the repository git clone https://github.com/yaalalabs/agent-kernel.git cd agent-kernel/ak-py # Install in development mode ./build.sh # Go to any example and run ./build.sh local ``` -------------------------------- ### Interact with Deployed Agents via API Gateway Source: https://github.com/yaalalabs/agent-kernel/blob/develop/examples/gcp-containerized/openai-auth/README.md Use curl to send requests to the API Gateway endpoint with JWT authentication. This includes examples for sending messages to agents and querying custom endpoints. ```bash # Get the API URL from Terraform outputs API_URL=$(terraform output -raw agent_invoke_url) # Get a JWT token (example using Google OAuth) # In production, your application should obtain this through OAuth flow JWT_TOKEN="your-jwt-token-here" # Send a math question to the triage agent with JWT authentication curl -X POST "${API_URL}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${JWT_TOKEN}" \ -d '{ "message": "What is the square root of 144?", "session_id": "user123" }' # Send a history question curl -X POST "${API_URL}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${JWT_TOKEN}" \ -d '{ "message": "Tell me about the American Civil War", "session_id": "user123" }' # Use the custom version endpoint curl -X GET "$(terraform output -raw gateway_url)/api/v1/version" \ -H "Authorization: Bearer ${JWT_TOKEN}" # Use the custom app_info endpoint curl -X POST "$(terraform output -raw gateway_url)/api/v1/app_info" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${JWT_TOKEN}" ``` -------------------------------- ### Langfuse Tracing Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/core-concepts/configuration.md Configures Langfuse tracing and installs the required extra. ```bash # Enable Langfuse tracing export AK_TRACE__ENABLED=true export AK_TRACE__TYPE=langfuse # Langfuse credentials export LANGFUSE_PUBLIC_KEY=pk-lf-... export LANGFUSE_SECRET_KEY=sk-lf-... export LANGFUSE_HOST=https://cloud.langfuse.com ``` ```bash pip install agentkernel[langfuse] ``` -------------------------------- ### Langfuse Observability Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.2.10/core-concepts/configuration.md Configures Langfuse tracing and installs the required Python package. ```bash # Enable Langfuse tracing export AK_TRACE__ENABLED=true export AK_TRACE__TYPE=langfuse # Langfuse credentials export LANGFUSE_PUBLIC_KEY=pk-lf-... export LANGFUSE_SECRET_KEY=sk-lf-... export LANGFUSE_HOST=https://cloud.langfuse.com ``` ```bash pip install agentkernel[langfuse] ``` -------------------------------- ### Install All Features Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/installation.md Installs everything including all frameworks and cloud providers. ```bash pip install agentkernel[openai,crewai,langgraph,adk,smolagents,pydanticai,api,aws,azure,gcp,cli] ``` -------------------------------- ### OpenLLMetry Tracing Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/core-concepts/configuration.md Configures OpenLLMetry (Traceloop) tracing and installs the required extra. ```bash # Enable OpenLLMetry tracing export AK_TRACE__ENABLED=true export AK_TRACE__TYPE=openllmetry # Traceloop credentials export TRACELOOP_API_KEY=your-api-key # Optional: for self-hosted export TRACELOOP_BASE_URL=https://api.traceloop.com ``` ```bash pip install agentkernel[openllmetry] ``` -------------------------------- ### Run the Demo Source: https://github.com/yaalalabs/agent-kernel/blob/develop/examples/sandbox/daytona/README.md Set the required OpenAI and Daytona API keys, then execute the demo script. ```bash export OPENAI_API_KEY=sk-... export DAYTONA_API_KEY=dtn_... uv run demo.py ``` -------------------------------- ### Pydantic Logfire Tracing Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/core-concepts/configuration.md Configures Pydantic Logfire tracing and installs the required extra. ```bash # Enable Logfire tracing export AK_TRACE__ENABLED=true export AK_TRACE__TYPE=logfire # Logfire credentials (optional — without a token, Logfire runs locally and does not ship traces) export LOGFIRE_TOKEN=your-write-token ``` ```bash pip install agentkernel[logfire] ``` -------------------------------- ### Setup Backend Infrastructure with Defaults Source: https://github.com/yaalalabs/agent-kernel/blob/develop/scripts/deploy/README.md Run the backend setup script using default values defined in state-config.yaml. ```bash ./scripts/deploy/setup_backend.sh gcp ``` -------------------------------- ### Run the application Source: https://github.com/yaalalabs/agent-kernel/blob/develop/examples/api/multimodal/thread-openai/README.md Set the OpenAI API key and start the application using uv. ```bash export OPENAI_API_KEY="your-openai-api-key" uv run python app.py ``` -------------------------------- ### Setup Virtual Environment with Conda Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/installation.md Create and activate a conda environment, then install Agent Kernel. ```bash # Create conda environment conda create -n .venv python=3.12 # Activate conda activate .venv # Install Agent Kernel pip install agentkernel[openai,api] ``` -------------------------------- ### Run the local CLI Source: https://github.com/yaalalabs/agent-kernel/blob/develop/use-cases/waste-sorting-assistant/README.md Set the OpenAI API key and start the local demonstration agent. ```bash export OPENAI_API_KEY="sk-..." uv run python demo.py ``` -------------------------------- ### GET /api/v1/threads Response Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.8.0/api/rest-api.md Example response for listing conversation threads, which is available when thread support is enabled. ```json { "threads": [{"session_id": "user-123", "name": "Trip planning", "user_id": "anne", "...": "..."}], "next_cursor": null } ``` -------------------------------- ### Deploy Authorizer Lambda Script Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/deployment/aws-serverless.md Example script for installing dependencies for the authorizer Lambda function into a distribution directory. ```bash # Install authorizer dependencies uv pip install --force-reinstall --no-deps agentkernel[api,aws] --target=auth_dist ``` -------------------------------- ### Run Session Context Example Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/integrations/hooks.md Commands to build the environment, run the session context demo, and execute tests. ```bash cd examples/cli/session-context # Build environment ./build.sh # Run the demo python demo.py # Run tests (in another terminal) uv run pytest -s ``` -------------------------------- ### Deploy Main Lambda Script Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/deployment/aws-serverless.md Example script for installing dependencies for the main Lambda function into a distribution directory. ```bash # Install main Lambda dependencies uv pip install -r requirements.txt --target=dist/data uv pip install --force-reinstall --target=dist/data agentkernel[openai,redis] ``` -------------------------------- ### Run the server Source: https://github.com/yaalalabs/agent-kernel/blob/develop/examples/api/instagram/README.md Starts the server on http://localhost:8000. ```bash uv run server.py ``` -------------------------------- ### Daytona Sandbox Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.8.0/advanced/sandbox.md Install the Daytona dependency, set your API key, and configure the sandbox type to daytona. ```bash pip install "agentkernel[daytona]" export DAYTONA_API_KEY=dtn_... ``` ```yaml sandbox: enabled: true type: daytona daytona: image: python:3.12-slim # container image for the sandbox... # snapshot: my-warm-snapshot # ...OR a named Daytona snapshot (mutually exclusive) env_vars: # environment variables set inside the sandbox APP_ENV: demo # target: us # Daytona target/region; omitted = SDK default # api_key_env: DAYTONA_API_KEY # env variable holding the API key broker: flavor: thread ``` -------------------------------- ### E2B Sandbox Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.8.0/advanced/sandbox.md Install the E2B dependency, set your API key, and configure the sandbox type to e2b. ```bash pip install "agentkernel[e2b]" export E2B_API_KEY=e2b_... ``` ```yaml sandbox: enabled: true type: e2b e2b: template: base # E2B sandbox template # api_key_env: E2B_API_KEY # env variable holding the API key broker: flavor: thread ``` -------------------------------- ### Manual development setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/DEVELOPER_GUIDE.md Manually build the environment from the ak-py directory. ```bash cd ak-py ./build.sh ``` -------------------------------- ### Docker Sandbox Setup Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.8.0/advanced/sandbox.md Install the Docker sandbox dependency and configure the sandbox type to docker in your YAML file. ```bash pip install "agentkernel[sandbox-docker]" ``` ```yaml sandbox: enabled: true type: docker docker: image: python:3.12-slim # any image with python broker: flavor: thread ``` -------------------------------- ### Install dependencies and set API key Source: https://github.com/yaalalabs/agent-kernel/blob/develop/examples/memory/valkey/README.md Prepares the environment by installing dependencies and setting the required OpenAI API key. ```bash ./build.sh export OPENAI_API_KEY= ``` -------------------------------- ### Setup Virtual Environment with venv Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/docs/installation.md Create and activate a virtual environment using venv, then install Agent Kernel. ```bash # Create virtual environment python -m venv .venv # Activate (Linux/macOS) source .venv/bin/activate # Activate (Windows) .venv\Scripts\activate # Install Agent Kernel pip install agentkernel[openai,api] ``` -------------------------------- ### Full Test Session Example Source: https://github.com/yaalalabs/agent-kernel/blob/develop/docs/versioned_docs/version-0.2.0/testing/cli-testing.md A complete example demonstrating how to initialize a test, perform multiple interactions, and clean up resources. ```python import asyncio from agentkernel.test import Test async def test_cricket_knowledge(): test = Test("demo.py", match_threshold=60) try: await test.start() # Test basic question await test.send("Who won the 1996 cricket world cup?") await test.expect("Sri Lanka won the 1996 cricket world cup.") # Test follow-up question await test.send("Which country hosted the tournament?") await test.expect("Co-hosted by India, Pakistan and Sri Lanka.") print("All tests passed!") finally: await test.stop() if __name__ == "__main__": asyncio.run(test_cricket_knowledge()) ```