Back to snippets

deepagents_quickstart_client_init_and_basic_chat_agent.py

python

A simple example demonstrating how to initialize a DeepAgents client and crea

Agent Votes
1
0
100% positive
deepagents_quickstart_client_init_and_basic_chat_agent.py
1import os
2from deepagents import DeepAgents
3
4# Set your API key in environment variables or pass it directly
5# os.environ["DEEP_AGENTS_API_KEY"] = "your_api_key_here"
6
7def main():
8    # Initialize the client
9    client = DeepAgents()
10
11    # Create a simple agent
12    agent = client.agents.create(
13        name="Assistant",
14        instructions="You are a helpful assistant that provides concise answers.",
15        model="gpt-4"
16    )
17
18    # Start a conversation
19    response = agent.chat("Hello! What can you help me with today?")
20    
21    print(f"Agent Response: {response.text}")
22
23if __name__ == "__main__":
24    main()