You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Flexible Agent Framework: build, orchestrate, and deploy AI agents and multi-agent systems
@@ -11,150 +11,21 @@ Highlights
11
11
12
12
Below are the basics for each language implementation. For more details on python see [here](./python/README.md) and for .NET see [here](./dotnet/README.md).
13
13
14
-
## Python - Quick Install
15
-
16
-
```bash
17
-
pip install agent-framework
18
-
# Optional: Add Azure integration
19
-
pip install agent-framework[azure]
20
-
# Optional: Add Foundry integration
21
-
pip install agent-framework[foundry]
22
-
# Optional: Both
23
-
pip install agent-framework[azure,foundry]
24
-
```
25
-
26
-
Supported Platforms:
27
-
- Python: 3.10+
28
-
- OS: Windows, macOS, Linux
29
-
30
-
## Python - 1. Setup API Keys
31
-
32
-
Set as environment variables, or create a .env file at your project root:
33
-
34
-
```bash
35
-
OPENAI_API_KEY=sk-...
36
-
OPENAI_CHAT_MODEL_ID=...
37
-
OPENAI_RESPONSES_MODEL_ID=...
38
-
...
39
-
AZURE_OPENAI_API_KEY=...
40
-
AZURE_OPENAI_ENDPOINT=...
41
-
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=...
42
-
...
43
-
FOUNDRY_PROJECT_ENDPOINT=...
44
-
FOUNDRY_MODEL_DEPLOYMENT_NAME=...
45
-
```
46
-
47
-
You can also override environment variables by explicitly passing configuration parameters to the chat client constructor:
48
-
49
-
```python
50
-
from agent_framework.azure import AzureChatClient
51
-
52
-
chat_client = AzureChatClient(
53
-
api_key=...,
54
-
endpoint=...,
55
-
deployment_name=...,
56
-
api_version=...,
57
-
)
58
-
```
59
-
60
-
See the following [setup guide](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started) for more information.
61
-
62
-
## Python - 2. Create a Simple Agent
63
-
64
-
Create agents and invoke them directly:
65
-
66
-
```python
67
-
import asyncio
68
-
from agent_framework import ChatClientAgent
69
-
from agent_framework.foundry import FoundryChatClient
70
-
71
-
asyncdefmain():
72
-
asyncwith ChatClientAgent(
73
-
chat_client=FoundryChatClient(),
74
-
instructions="""These are the Three Laws of Robotics:
75
-
1) A robot may not injure a human being...
76
-
2) A robot must obey orders given it by human beings...
77
-
3) A robot must protect its own existence...
78
-
79
-
Respond concisely to the user's request.
80
-
"""
81
-
):
82
-
result =await agent.run("Summarize the Three Laws of Robotics")
83
-
print(result.text)
84
-
"""
85
-
Output:
86
-
Protect humans, obey, self-preserve, prioritized.
87
-
"""
88
-
89
-
if__name__=="__main__":
90
-
asyncio.run(main())
91
-
```
92
-
93
-
## Python - 3. Build an Agent with Tools
94
-
95
-
Enhance your agent with custom tools and function calling:
96
-
97
-
```python
98
-
import asyncio
99
-
from typing import Annotated
100
-
from random import randint
101
-
from pydantic import Field
102
-
from agent_framework import ChatClientAgent
103
-
from agent_framework.openai import OpenAIResponsesClient
104
-
105
-
106
-
defget_weather(
107
-
location: Annotated[str, Field(description="The location to get the weather for.")],
returnf"The weather in {location} is {conditions[randint(0, 3)]} with a high of {randint(10, 30)}°C."
112
-
113
-
114
-
defget_menu_specials() -> str:
115
-
"""Get today's menu specials."""
116
-
return"""
117
-
Special Soup: Clam Chowder
118
-
Special Salad: Cobb Salad
119
-
Special Drink: Chai Tea
120
-
"""
121
-
122
-
123
-
asyncdefmain():
124
-
agent = ChatClientAgent(
125
-
chat_client=OpenAIResponsesClient(),
126
-
instructions="You are a helpful assistant that can provide weather and restaurant information.",
127
-
tools=[get_weather, get_menu_specials]
128
-
)
129
-
130
-
response =await agent.run("What's the weather in Amsterdam and what are today's specials?")
131
-
print(response.text)
132
-
133
-
"""
134
-
Output:
135
-
The weather in Amsterdam is sunny with a high of 22°C. Today's specials include
136
-
Clam Chowder soup, Cobb Salad, and Chai Tea as the special drink.
137
-
"""
138
-
139
-
if__name__=="__main__":
140
-
asyncio.run(main())
141
-
```
142
-
143
-
You can explore additional agent samples [here](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents).
144
-
145
-
**Note**: Advanced orchestration patterns like GroupChat, Sequential, and Concurrent orchestrations are coming soon.
146
-
147
14
## More Examples & Samples
148
15
149
-
-[Getting Started with Agents](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents): Basic agent creation and tool usage
150
-
-[Chat Client Examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/chat_client): Direct chat client usage patterns
151
-
-[Azure Integration](https://github.com/microsoft/agent-framework/tree/main/python/packages/azure): Azure OpenAI and AI Foundry integration
0 commit comments